#pragma once 

#include <memory>
using namespace std;

class BaseMsg {
public:
    virtual ~BaseMsg() {}
public:
    enum TYPE {
        SERVICE = 1, 
        SOCKET_ACCEPT = 2, 
        SOCKET_RW = 3, 
    };

    uint8_t type; // msg type
};

class ServiceMsg : public BaseMsg  {
public:
    uint32_t source;        // 消息发送方
    shared_ptr<char> buff;  // 消息内容
    size_t size;            // 消息内容大小
};

class SocketAcceptMsg : public BaseMsg {
public:
    int listenfd;
    int clientfd;
};

class SocketRWMsg : public BaseMsg {
public:
    int fd; 
    bool isRead = false;
    bool isWrite = false;
};